# $Id: PKGBUILD 79596 2012-11-08 15:28:33Z heftig $
# Maintainer : Laurent Carlier <lordheavym@gmail.com>
# Maintainer : Daenyth <Daenyth+Arch _AT_ gmail _DOT_ com>
# Contributor : wizzomafizzo <wizzomafizzo@gmail.com>
# Contributor: tochiro@no.spam.mail.berlios.de
# Contributor: sh__

pkgname=uqm
pkgver=0.7.0
pkgrel=3
pkgdesc="The Ur-Quan Masters, a port of Star Control 2"
arch=('i686' 'x86_64')
url="http://sc2.sf.net/"
license=('GPL')
depends=('libmikmod' 'libvorbis' 'sdl_image' 'libgl' 'glu')
makedepends=('imagemagick' 'mesa' 'namcap')
optdepends=('uqm-sound: For extra music and conversation audio')
source=(http://downloads.sourceforge.net/sourceforge/sc2/uqm-${pkgver}-source.tgz
        http://downloads.sourceforge.net/sourceforge/sc2/uqm-${pkgver}-content.uqm
        config.state
        uqm
        uqm.desktop
        uqm.png)
noextract=(uqm-${pkgver}-content.uqm)
md5sums=('f9018ea0493d7dac6a9e1006b00af7df'
         '2f36dcb15274dbbcb5e266f2ed84d5b2'
         'ca497b754edf56aab8a5791f1d2c974a'
         '07e64632fce6323a14ab558d0214b885'
         '44c83b9b9d102b99210af0036749a318'
         '06d0a72aa18e7edce6cd3c7a3a747c44')

package() {
  cd $srcdir/$pkgname-$pkgver
  
  cp $srcdir/config.state .
  sed -e "/INPUT_install_prefix/ s|replaceme|$pkgdir/usr|" \
      -i config.state
  ./build.sh uqm reprocess_config

  ./build.sh uqm
  ./build.sh uqm install

  install -Dm644 $srcdir/$pkgname-$pkgver-content.uqm \
     $pkgdir/usr/share/uqm/content/packages/$pkgname-$pkgver-content.uqm

  # stolen from fedora!
  install -Dm644 $srcdir/uqm.desktop \
     $pkgdir/usr/share/applications/uqm.desktop
  install -Dm644 $srcdir/uqm.png \
     $pkgdir/usr/share/pixmaps/uqm.png

  rm $pkgdir/usr/bin/uqm
  install -Dm755 $srcdir/uqm $pkgdir/usr/bin/uqm
}
